import { FC, useMemo } from "react"

import { SFormItem } from "@/components/common"
import StyleSelect from "@/components/common/styleSelect"
import { useLocale } from "@/locales"
// import dynamicComponent from "./dynamicImport"

export type TimeTypeField = {
	timeType: string
}
const TimeTypeSelector: FC<{ noDeposit?: boolean; forAgent?: boolean }> = props => {
	//todo: 后端在会员列表和代理列表，注册时间的字典值不一样
	const { formatMessage } = useLocale()
	const options = [
		{ label: formatMessage({ id: "label.member.register_time" }), value: props.forAgent ? 1 : 0 },
		{ label: formatMessage({ id: "label.member.first_deposit_date_time" }), value: props.forAgent ? 0 : 1 },
		{ label: formatMessage({ id: "label.member.last_login_date_time" }), value: 2 }
	]
	const computedOptions = useMemo(() => {
		return props.noDeposit ? [options[0], options[2]] : options
	}, [props.noDeposit])

	return (
		<SFormItem name="timeType">
			<StyleSelect options={computedOptions} style={{ width: "150px" }} placeholder={formatMessage({ id: "label.select_all" })} />
		</SFormItem>
	)
}

export default TimeTypeSelector
